package com.itheima.pojo;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import java.util.Date;
@Component
@Data
public class User {
    @Value("貂蝉")
    private String username;
    @Autowired
    private Date date;
    /*@Autowired
    @Qualifier("address2")*/
    @Resource(name="address1")
    private Address address;
    @PostConstruct
    public void init(){
        System.out.println("初始化完成");
    }
@PreDestroy
    public void destroy(){
        System.out.println("销毁");
    }
}
